home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17963 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  76 lines

  1. Newsgroups: comp.lang.c++
  2. Path: news.gil.com.au!news
  3. From: pcollins@gil.com.au (Peter Collins)
  4. Subject: HELP - using list class in TC++ V3
  5. Sender: news@gil.com.au
  6. Message-ID: <Dq1H6r.K8t@gil.com.au>
  7. Date: Thu, 18 Apr 1996 15:45:05 GMT
  8. X-Nntp-Posting-Host: ppp9.ipswich.gil.com.au
  9. Organization: Global Infolinks Internet Server, Ipswich Qld Australia
  10. X-Newsreader: Forte Agent .99b.112
  11.  
  12. I am attempting to use the List class in Borland Turbo C++ V3 for DOS
  13. I cannot see what is wrong.
  14. Thanks in advance if you can help.
  15.  
  16. #include <iostreams.h>
  17. #include <list.h>
  18. #include <strng.h>
  19.  
  20. // Turbo C++ program for DOS
  21. // I am trying to use the List class to store a list of objects.
  22. // However I get the error messages below - I'v included them as
  23. comments.
  24.  
  25. // declare a object
  26. class nc {
  27. private:
  28.     int a;
  29.  
  30. public:
  31.     int b;
  32.     nc(void){;};
  33.     ~nc(void){;};
  34.     };
  35.  
  36.  
  37. void main()
  38. {
  39.  
  40. List alist;   // declare a list
  41. nc h;         // declare a instance of the object above
  42.  
  43. alist.add(h);   // try and add it to the list
  44.  
  45. }
  46.  
  47. // Error messages when attempt to compile this file
  48. // Compiling LISTTST1.CPP:
  49. // Warning LISTTST1.CPP 21: Temporary used for parameter 1 in call to
  50. 'List::add(Object &)'
  51. // Error LISTTST1.CPP 21: Cannot create instance of abstract class
  52. 'Object'
  53. // Error LISTTST1.CPP 21: Cannot create instance of abstract class
  54. 'Object'
  55. // Error LISTTST1.CPP 21: Could not find a match for
  56. 'Object::Object(nc)'
  57. // Error LISTTST1.CPP 21: Type mismatch in parameter 1 in call to
  58. 'List::add(Object &)'
  59.  
  60.  
  61. // This is the help file entry for list
  62. // List::add (member function)
  63. // Declaration:
  64. // void add(Object& toAdd);
  65. // Remarks:
  66. // Adds an object to the list. The object becomes the new head of the
  67. list.
  68. // See Also:
  69. // List
  70.  
  71.  
  72.  
  73. --
  74. pcollins@gil.com.au
  75.  
  76.